package xin.javashare.designPattern.creation.factoryMethod;

import xin.javashare.designPattern.creation.factoryMethod.service.Sender;
import xin.javashare.designPattern.creation.factoryMethod.service.serviceImp.MailSender;
import xin.javashare.designPattern.creation.factoryMethod.service.serviceImp.SmsSender;

/**
 * 工厂类
 * 工厂方法模式   之   静态工厂方法模式
 */
public class StaticSendFactory {
    // 静态工厂方法1
    public static Sender produceMail() {
        return new MailSender();
    }
    // 静态工厂方法2
    public static Sender produceSms(){
        return new SmsSender();
    }

    // 测试
    public static void main(String[] args) {
        Sender sender = StaticSendFactory.produceMail();// 直接调用
        sender.Send();
    }
}
